﻿/*************************************************
版权所有(C), 2012, 广州新昊网络科技有限公司
文件名称： WebKits.cs 
作者: 卢盛福
QQ：34885177
完成日期: 2012/8/27 17:14:16
环境版本：4.0.30319.239
主要内容:详细说明此程序文件完成的功能
-----------------第一次修改-----------------
修改作者：
QQ：
修改日期：
环境版本：
修改内容：
*************************************************/

using System.Web.UI;
using System.Web;

namespace CrazyTalk.Web.UI
{
    public class WebKits : Page
    {
        /// <summary>
        /// 错误提示
        /// </summary>
        /// <param name="Msg">内容</param>
        /// <param name="IsException">true:系统异常信息false:自定义错误提示</param>
        /// <param name="Url">地址</param>
        /// <param name="IsAutoReturn">是否自动返回</param>
        /// <param name="CustomHtml">自定义Html标签</param>
        public static void PageRender(string Msg, bool IsException, string Url, bool IsAutoReturn, string CustomHtml)
        {
            string Dir = Common.RequestHelper.GetRootURI() + "/Images/error";
            string STitle = "操作失败信息!";
            string ReUrlStr = "";
            string _tmp = "<img src=\"" + Dir + "/error.gif\" border=\"0\">";
            string SCaption = "<font color=\"red\">抱歉！操作失败</font>";
            //if (IsException)
            //{
            //}
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\r<head>\r");
            HttpContext.Current.Response.Write("<title>" + STitle + "_aspxcms Inc.</title>\r");
            HttpContext.Current.Response.Write("<link href=\"" + Dir + "/css.css\" rel=\"stylesheet\" type=\"text/css\" />\r");
            HttpContext.Current.Response.Write("<script src=\"" + Dir + "/Public.js\" language=\"javascript\" type=\"text/javascript\"></script>\r");
            HttpContext.Current.Response.Write("\r</head>\r");
            if (IsAutoReturn)
            {
                if (!string.IsNullOrEmpty(Url))
                {
                    HttpContext.Current.Response.Write("<body onload=\"returnPage('" + Url + "');\" style=\"margin-top:50px;\">\r");
                    //if (string.IsNullOrEmpty(CustomHtml))
                    //{
                    //    ReUrlStr = "<li><span style=\"color:blue\">4秒后自动转向...</span></li>";
                    //}
                    //else
                    //    ReUrlStr = CustomHtml;
                }
            }
            else
            {
                HttpContext.Current.Response.Write("<body style=\"margin-top:50px;\">\r");
            }
            HttpContext.Current.Response.Write("<table style=\"width:65%;height:180px;\"  border=\"0\" align=\"center\" cellspacing=\"1\" cellpadding=\"5\" class=\"table\">\r   <tr class=\"TR_BG\"><td class=\"sysmain_navi\" style=\"height:38px;\" colspan=\"2\">" + SCaption + "</td>\r");
            HttpContext.Current.Response.Write("</tr><tr class=\"TR_BG_list\"><td class=\"list_link\" align=\"center\" style=\"40%\">" + _tmp + "<br /><br /></td><td class=\"list_link\"><font color=red>操作描述：</font>\r");
            HttpContext.Current.Response.Write("<ul>\r");
            HttpContext.Current.Response.Write(" <li><span style=\"word-wrap:bread-word;word-break:break-all;font-size:11.5px;\">" + Msg + "</span></li>" + ReUrlStr + "\r");
            if (!string.IsNullOrWhiteSpace(CustomHtml))
            {
                HttpContext.Current.Response.Write(CustomHtml);
            }
            HttpContext.Current.Response.Write("<li><a href='javascript:history.back();'><font color=\"red\">返回上一级</font></a>&nbsp;&nbsp;&nbsp;&nbsp</li>\r");
            HttpContext.Current.Response.Write("</ul></td></tr>\r    </table>\r");
            HttpContext.Current.Response.Write("</body>\r</html>\r");
            HttpContext.Current.Response.End();
        }
    }
}
